package git.soulbgm.handle;

import git.soulbgm.common.Constants;
import git.soulbgm.group.OutAndInStandingStatisticsGroup;
import git.soulbgm.pojo.DataSegmentContentSummaryInfo;
import org.springframework.kafka.annotation.KafkaHandler;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;


/**
 * 数据段内容摘要信息监听器
 *
 * @author SoulBGM
 * @date 2024-11-04
 */
@Component
@KafkaListener(topics = Constants.TOPIC_DATA_SEGMENT_CONTENT_SUMMARY)
public class DataSegmentContentSummaryInfoHandle {

    private final OutAndInStandingStatisticsGroup statisticsGroup;

    public DataSegmentContentSummaryInfoHandle(OutAndInStandingStatisticsGroup statisticsGroup) {
        this.statisticsGroup = statisticsGroup;
    }

    @KafkaHandler
    public void listen(DataSegmentContentSummaryInfo info) {
        try {
            statisticsGroup.groupOutAndInStandingStatisticsData(info);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
